// 图片上传前的检查
export const beforeUploadCheck = function(file, conditon) {
  const { format, size } = conditon
  const isFormat = format ? format.includes(file.type) : true
  const isSize = !(file.size / 1024 / 1024 > size)
  let error = null
  if (!isFormat) {
    error = 'format'
  }
  if (!isSize) {
    error = 'size'
  }
  return {
    passed: isFormat && isSize,
    error
  }
}
